package com.example.myfirstapp;

import android.annotation.SuppressLint;
import android.util.Log;
import android.widget.TextView;
import androidx.appcompat.app.AppCompatActivity;

import android.os.Build;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.Toast;

public class ShowApiLevel extends AppCompatActivity {

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_show_api_level);

        Button btn_show = findViewById(R.id.button_show);

        btn_show.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View view) {
                TextView textView = findViewById(R.id.textView_show);
                if (textView == null) {
                    Log.d("Fuck", "textView == null");
                } else {
                    textView.setText(Build.VERSION.SDK_INT);
                }
                Toast toast = Toast.makeText(getApplicationContext(), R.string.app_name, Toast.LENGTH_LONG);
                toast.show();
            }
        });
    }
}
